<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>layout 后台大布局 - Layui</title>
  <link rel="stylesheet" href="@{'/public/layui/css/layui.css'}" media="all">
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
  <div class="layui-header">
    <div class="layui-logo"><strong style="font-size: 28px;font-family:'楷体'">后台管理系统</strong></div>
    <!-- 头部区域（可配合layui已有的水平导航） -->
    <ul class="layui-nav layui-layout-left">
     <!--  <li class="layui-nav-item"><a href="">控制台</a></li>
      <li class="layui-nav-item"><a href="">商品管理</a></li>
      <li class="layui-nav-item"><a href="">用户</a></li>
      <li class="layui-nav-item">
        <a href="javascript:;">其它系统</a>
        <dl class="layui-nav-child">
          <dd><a href="">邮件管理</a></dd>
          <dd><a href="">消息管理</a></dd>
          <dd><a href="">授权管理</a></dd>
        </dl>
      </li> -->
    </ul>
    <ul class="layui-nav layui-layout-right">
      <li class="layui-nav-item">
        <a href="javascript:;">
          <img src="http://t.cn/RCzsdCq" class="layui-nav-img">
          ${name}
        </a>
        <dl class="layui-nav-child">
          <dd><a href="">基本资料</a></dd>
          <dd><a href="">安全设置</a></dd>
        </dl>
      </li>
      <li class="layui-nav-item"><a href="/login">退出</a></li>
    </ul>
  </div>
  
  <div class="layui-side layui-bg-black">
    <div class="layui-side-scroll">
      <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
      <ul class="layui-nav layui-nav-tree"  lay-filter="test">
        <li class="layui-nav-item layui-nav-itemed">
          <a class="" href="javascript:;">所有商品</a>
          <dl class="layui-nav-child">
            <dd ><a href="/levelOne">一级目录</a></dd>
            <dd class="layui-this"><a href="/levelTwo">二级目录</a></dd>
            <dd ><a href="/Commodity">所有商品</a></dd>
          </dl>
        </li>
        <li class="layui-nav-item">
          <a href="javascript:;">解决方案</a>
          <dl class="layui-nav-child">
            <dd><a href="javascript:;">列表一</a></dd>
            <dd><a href="javascript:;">列表二</a></dd>
            <dd><a href="">超链接</a></dd>
          </dl>
        </li>
        <li class="layui-nav-item"><a href="">邮件管理</a></li>
        <li class="layui-nav-item"><a href="">发布商品</a></li>
      </ul>
    </div>
  </div>
  
  
  <div class="layui-body">
    <!-- 内容主体区域 -->
    
    <div style="padding: 15px;">
    	<ul class="layui-tab-title">
						<li class="layui-this">
							<i class="fa fa-dashboard" aria-hidden="true"></i>
							<cite>二级目录</cite>
						</li>
						<li>
					 <button id='add' class="layui-btn"  onclick="innerWarning()"><i class="layui-icon">&#xe608;</i> 
					 添加信息</button>
						</li>
					</ul>
  		  <table class="layui-table"  lay-data="{height:313,page:true}" >
			  <thead>
			    <tr >
			      <th lay-data="{field:'id', width:80, sort: true}">ID</th>
			      <th lay-data="{field:'name', width:200, sort: true}">用户名</th>
			      <th lay-data="{field:'bianji', width:150}"  >操作</th>
			    </tr>
			  </thead>
			  #{list items:page.result,as:'item'}
			  <tr>	
			  <td>${item.id}</td>
			  <td>${item.name}</td>
				<td>
				<a href="/detail-1" target="_blank" class="layui-btn layui-btn-normal layui-btn-mini">编辑</a>
				<a href="javascript:deleteById(${item.id})"  class="layui-btn layui-btn-mini layui-btn-warm">删除</a>
				</td>
			  </tr>
			  #{/list}
		</table>
	</div>
  </div>
  
  <div class="layui-footer">
    © layui.com - 底部固定区域
  </div>
</div>
<script src="@{'public/layui/layui.js'}"></script>
<script src="@{'public/js/jquery-2.1.4.min.js'}"></script>

<script>
//JavaScript代码区域
layui.use('element', function(){
  var element = layui.element;
  
});
</script>

<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
layui.use('table', function(){
  var table = layui.table;
  
});

 function deleteById(id){
	 layer.confirm('<span  style="font-size:12px;color:red">(删除二级目录,会删除与之有关联的商品)</span></br>确认删除吗？', {btn: ['确定','关闭']},
	      function(){
			 $.ajax({
				 	url: "@{manage.deleteById()}",
					type: "GET",
					async:false,
					data:{"id":id},
					dataType: "text",
					success: function(data) {
						if(data){
							 layer.confirm('删除成功！</br>', {
						        btnAlign: 'c',
						        btn: ['确定']
						      },function()
						      {window.location.href="/indexManage";}
						      ); 
						}else{
							layer.alert("删除失败!");
						}
					},
					error: function(data) {
						layer.alert("您的账户可能出现异常，请重新刷新获取账号信息!");
					}
		  	})
		 }
	  ); 
} 
 
 $('#add').on('click', function() {
	 layer.open({
		  type: 1,
		  title:'运营提醒',
		  content: $('.edit-innerWarning'),
		  area: ['400px', '']
		});	
	});
 
//关闭弹窗
	function  close(){
		layer.closeAll()	
	}
</script>
<div class="edit-innerWarning" hidden="hidden"  style="padding: 17px 0 20px 30px;"  >
	<div class="layui-form-item layui-block">
		<label class="layui-form-label">目录名称</label>
		<div class="layui-input-inline">
			<input type="text" name="warningQuery.name" required lay-verify="required" placeholder="必填项" class="layui-input">
		</div>
	</div>
	<div class="layui-form-item layui-block">
		<label class="layui-form-label">状态：</label>
		<div class="layui-input-inline">
			<div class="select-wrap">
				<input type="radio" name="warningQuery.state" id="Disable" value="0" title="停用"><label  for="">停用</label>
			</div>
			<div class="select-wrap">
				<input type="radio" name="warningQuery.state"  id="Enable" value="1" title="启用"><label  for="">启用</label> 
			</div>
		</div>
	</div>
	<div class="operate-btn">
		<a href="javascript:updateById()" class="layui-btn layui-btn-small">确认</a>
		<a href="javascript:close();" class="layui-btn layui-btn-primary layui-btn-small">取消</a>
	</div>
</div>
</body>
</html>